const Router = require('koa-router')()
const user = require('../control/course')
/**
 * @api {post} /course/add 课程添加
 * @apiName courseAdd
 * @apiGroup getScore
 * @apiDescription 课程添加
 * @apiParam (params) {String} courseName 课程名称
 * @apiParam (params) {String} credit 学分
 * @apiParam (params) {String} remark 备注
 * @apiParam (params) {String} teacher 老师id
 * @apiHeaderExample {json} Header:
 * {
 *    "Authorition": "Bearer xxxxxxxxxxxx(登陆时获取的token)"
 *  }
 *
 * @apiSuccessExample 成功
 * {
    "code": 1,
    "data": null,
    "msg": "创建课程成功"
 *
 */
Router.post('/add', user.add)
/**
 * @api {post} /course/update 课程状态修改
 * @apiName courseUpdate
 * @apiGroup courseUpdate
 * @apiDescription 课程状态修改
 * @apiParam (params) {String} courseId 课程id
 * @apiParam (params) {String} status 课程状态 1：已发布（管理员权限控制） 0：未发布（管理员权限控制） 2：已经开课（老师权限控制）
 * @apiParam (params) {String} remark 备注
 * @apiParam (params) {String} teacher 老师id
 * @apiHeaderExample {json} Header:
 * {
 *    "Authorition": "Bearer xxxxxxxxxxxx(登陆时获取的token)"
 *  }
 *
 * @apiSuccessExample 成功
 * {
    "code": 1,
    "data": "课程状态修改成功",
    "msg": "请求成功"
 *
 */
Router.post('/update', user.update)
/**
 * @api {post} /course/del 课程删除
 * @apiName courseDel
 * @apiGroup courseDel
 * @apiDescription 课程删除
 * @apiParam (params) {String} courseId 课程id
 * @apiHeaderExample {json} Header:
 * {
 *    "Authorition": "Bearer xxxxxxxxxxxx(登陆时获取的token)"
 *  }
 *
 * @apiSuccessExample 成功
 * {
    "code": 1,
    "data": "删除成功",
    "msg": "请求成功"
 *
 */
Router.post('/del', user.del)
/**
 * @api {post} /course/inquire 课程查询
 * @apiName courseInquire
 * @apiGroup courseInquire
 * @apiDescription 课程查询
 * @apiParam (params) {String} pageSize 分页
 * @apiHeaderExample {json} Header:
 * {
 *    "Authorition": "Bearer xxxxxxxxxxxx(登陆时获取的token)"
 *  }
 *
 * @apiSuccessExample 成功
 * {
    "code": 1,
    "data": {
      courseLists: [],
      totalPage:2
  }
 *
 */

Router.post('/inquire', user.inquire)

module.exports = Router
